package practice;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.annotation.ElementType;

public class p008 {
    public static void main(String[] args) {
        FileOutputStream fos = null;
        FileInputStream fis = null;
        try {
            fis = new FileInputStream("F:\\untitled\\src\\practice\\temp001.txt");
            fos = new FileOutputStream("F:\\untitled\\src\\practice\\temp002.txt");
            byte[] bytes = new byte[1024*1024];
            int read = 0;
            while((read = fis.read(bytes)) != -1){
                  fos.write(bytes,0,read);

            }

        }
        catch (FileNotFoundException e ){
            e.printStackTrace();
        }
        catch (IOException e ){
            e.printStackTrace();
        }
     finally {
            if(fos != null){
             try {
                 fos.close();
             }
             catch (IOException e ) {
                 e.printStackTrace();
             }
            }
if(fis != null){
    try{
        fis.close();
    }
    catch (IOException e ){
        e.printStackTrace();
    }
}

        }
    }
}
